package userInterface;

import java.awt.BorderLayout;
import java.awt.Rectangle;

import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JPanel;

import model.Control;

/**
 * This class creates the Bidder's Menu GUI
 * @author Igor
 * minor modifications by Daniel Bartholomew
 *
 */
@SuppressWarnings("serial")
public class BidderMenuView extends JFrame {

	private JPanel jContentPane = null; 
	private JDesktopPane jDesktopPane = null; 
	private JButton btnViewMyBids = null; 
	private JButton btnViewAuctions = null;

	private Control my_control;
	
	/**
	 * default constructor
	 */
	public BidderMenuView(Control control) {
		super();
		my_control = control;
		setSize(640, 480);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setVisible(true);
		setResizable(false);
		this.setSize(640, 480);
		initialize();
	}

	/**
	 * initializes component
	 * @return void
	 */
	private void initialize() {
		jContentPane = new JPanel();
		jContentPane.setLayout(new BorderLayout());
		jDesktopPane = new JDesktopPane();

		btnViewMyBids = new JButton("View My Bids");
		btnViewMyBids.setBounds(new Rectangle(250, 60, 140, 30));

		btnViewMyBids.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent e) {
				BidListView blv = new BidListView(my_control);
				blv.setLocationRelativeTo(null);
				blv.setVisible(true);
				dispose();
			}
		});
		jDesktopPane.add(btnViewMyBids, null);
		btnViewAuctions = new JButton("View Auctions");
		btnViewAuctions.setBounds(new Rectangle(250, 120, 140, 30));
		btnViewAuctions.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent e) {
				AuctionListView alv = new AuctionListView(my_control);
				alv.setLocationRelativeTo(null);
				dispose();
			}
		});
		jDesktopPane.add(btnViewAuctions, null);
		jContentPane.add(jDesktopPane, BorderLayout.CENTER);
		this.setContentPane(jDesktopPane);
		this.setTitle("Bidder Menu View");
		setLocationRelativeTo(null);
	}
}
